﻿using System;
using System.Windows.Forms;
using UniMana.Data;
using UniMana.Utils.Data;
using System.Data;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using UniMana.Utils.Helper;

namespace UniMana.Win.Training
{
    public partial class FrmStudent_SubAcademicHandlingTransferCourse : DevExpress.XtraEditors.XtraForm
    {
        private DBMain m_data = new DBMain();
        private DataTable m_tblTable;

        int m_iTraining_ProgramKey = 0;
        int m_iTraining_ProgramKeyChange = 0;
        int m_iCatalogue_CourseKey = 0;
        int m_iCatalogue_CourseKeyChange = 0;
        int m_iCatalogue_LevelKey = 0;
        int m_iCatalogue_LevelKeyChange = 0;
        int m_iCatalogue_MajorKey = 0;
        int m_iCatalogue_MajorKeyChange = 0;
        int m_iCatalogue_TrainingTypeKey = 0;
        int m_iCatalogue_TrainingTypeKeyChange = 0;
        int m_iCatalogue_DepartmentKey = 0;
        int m_iCatalogue_DepartmentKeyChange = 0;
        int m_iTraining_ClassKey;
        int m_iTraining_ClassKeyChange;

        Training_TrainingProgramInfo trnprogramInfo;
        Training_Student_ClassInfo studentclassInfo;
        Training_StudentInfo studentInfo;
        Training_ClassInfo classInfo;

        string m_strTraining_StudentKey;
        //int m_iCatalogue_StatusKey;

        /// <summary>
        /// Khởi tạo form
        /// </summary>
        /// <param name="m_strTraining_StudentKey"></param>
        /// <param name="m_strID"></param>
        /// <param name="m_dBirthday"></param>
        /// <param name="m_strExceptionBirthday"></param>
        /// <param name="m_strGender"></param>
        /// <param name="m_strLastName"></param>
        /// <param name="m_strSureName"></param>
        /// <param name="m_iTraining_ClassKey"></param>
        /// <param name="m_iCatalogue_StatusKey"></param>
        /// <param name="m_iTraining_ProgramKey"></param>
        /// <param name="m_itraferflag"></param>

        public FrmStudent_SubAcademicHandlingTransferCourse(string m_strTraining_StudentKey, int m_iMajorKey, int m_iLevelKey, int m_iTrainingTypeKey, int m_iCourseKey)
        {
            InitializeComponent();

            this.m_strTraining_StudentKey = m_strTraining_StudentKey;
            this.m_iCatalogue_CourseKey = m_iCourseKey;
            this.m_iCatalogue_LevelKey = m_iLevelKey;
            this.m_iCatalogue_MajorKey = m_iMajorKey;
            this.m_iCatalogue_TrainingTypeKey = m_iTrainingTypeKey;

            if ((m_iCatalogue_CourseKey <= 0) || (m_iCatalogue_LevelKey <= 0) || (m_iCatalogue_MajorKey <= 0) || (m_iCatalogue_TrainingTypeKey <= 0))
            {
                XtraMessageBox.Show("Các thông tin Ngành, bậc, khóa học, loại hình đào tạo của sinh viên không đầy đủ", "Thông báo");
                this.Close();
            }
            studentclassInfo = new Training_Student_ClassInfo("nguyen.tuanan", m_strTraining_StudentKey, m_iCatalogue_LevelKey, m_iCatalogue_MajorKey, m_iCatalogue_TrainingTypeKey, m_iCatalogue_CourseKey);
            if (studentclassInfo.Properties.Training_TrainingProgramKey == null)
            {
                XtraMessageBox.Show("Sinh viên chưa có chương trình đào tạo", "Thông báo");
                this.Close();
            }
            if ((studentclassInfo.Properties.Catalogue_StatusKey == 1) || (studentclassInfo.Properties.Catalogue_StatusKey == 3))
            { }
            else
            {
                XtraMessageBox.Show("Chỉ sinh viên còn học hoặc bảo lưu mới được chuyển ngành, chuyển khóa", "Thông báo");
                this.Close();
            }
        }

        /// <summary>
        /// Form load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void Frm_AcademicHandling_Transfer_Course_Load(object sender, EventArgs e)
        {

            gluCatalogue_Course.GetData(m_data.m_DCReadOnly.Catalogue_Courses.GetCourseKeyNameInTrainingProgram
                                                             (
                                                                m_data.m_DCReadOnly.Training_TrainingPrograms, 
                                                                m_data.m_DCReadOnly.Catalogue_Majors
                                                              ).ToDataTable(), "Catalogue_CourseKey", "Name");

            gluCatalogue_Major.GetData(m_data.m_DCReadOnly.Catalogue_Majors.GetMajorInTraingProgram
                                                              (
                                                                 m_data.m_DCReadOnly.Training_TrainingPrograms, 
                                                                 m_data.m_DCReadOnly.Catalogue_Levels
                                                               ).ToDataTable(), "Catalogue_MajorKey", "Name");

            gluCatalogue_Department.GetData(m_data.m_DCReadOnly.Catalogue_Departments.GetDepartmentInTrainingProgram(m_data.m_DCReadOnly.Training_TrainingPrograms, m_data.m_DCReadOnly.Catalogue_Majors).ToDataTable(), "Catalogue_DepartmentKey", "Name");
            gluCatalogue_Level.GetData(m_data.m_DCReadOnly.Catalogue_Levels.ToDataTable(), "Catalogue_LevelKey", "Name"); 

            gluCatalogue_TrainingType.GetData(m_data.m_DCReadOnly.Catalogue_TrainingTypes.GetTrainingTypeInTraingProgram 
                                                              (
                                                                 m_data.m_DCReadOnly.Training_TrainingPrograms, 
                                                                 m_data.m_DCReadOnly.Catalogue_Majors
                                                               ).ToDataTable(), "Catalogue_TrainingTypeKey", "Name");

            gluTraining_TrainingProgram.GetData(m_data.m_DCReadOnly.Training_TrainingPrograms, "Training_TrainingProgramKey", "Name");
            lueTraining_TranferType.GetData(m_data.m_DCReadOnly.Training_TranferTypes.GetData(), "Training_TranferTypeKey", "Name");

            lueCatalogue_Department1.GetData(m_data.m_DCReadOnly.Catalogue_Departments.GetDepartmentInTrainingProgram
                                                               (
                                                                  m_data.m_DCReadOnly.Training_TrainingPrograms, 
                                                                  m_data.m_DCReadOnly.Catalogue_Majors
                                                                ).ToDataTable(), "Catalogue_DepartmentKey", "Name");

            lueCatalogue_Course1.GetData(m_data.m_DCReadOnly.Catalogue_Courses.GetCourseKeyNameInTrainingProgram
                                                                (
                                                                  m_data.m_DCReadOnly.Training_TrainingPrograms, 
                                                                  m_data.m_DCReadOnly.Catalogue_Majors
                                                                 ).ToDataTable(), "Catalogue_CourseKey", "Name");

            lueCatalogue_Level1.GetData(m_data.m_DCReadOnly.Catalogue_Levels.ToDataTable(), "Catalogue_LevelKey", "Name");

            lueCatalogue_Major1.GetData(m_data.m_DCReadOnly.Catalogue_Majors.GetMajorInTraingProgram
                                                                 (
                                                                   m_data.m_DCReadOnly.Training_TrainingPrograms, 
                                                                   m_data.m_DCReadOnly.Catalogue_Levels
                                                                  ).ToDataTable(), "Catalogue_MajorKey", "Name");

            lueCatalogue_TrainingType1.GetData(m_data.m_DCReadOnly.Catalogue_TrainingTypes, "Catalogue_TrainingTypeKey", "Name");

            HandlingData();
            LoadListSheet();
            rluTraining_Student.GetData(m_data.m_DCReadOnly.Training_Students.GetData(), "Training_StudentKey", "Name");
            rluTraining_TrainingProgram.GetData(m_data.m_DCReadOnly.Training_TrainingPrograms.GetData(), "Training_TrainingProgramKey", "Name");
            Auto.Enabled = true;
        }        

        /// <summary>
        /// Xử lý dữ liệu sinh viên chuyển qua
        /// </summary>

        private void HandlingData()
        {
            studentInfo = new Training_StudentInfo(m_strTraining_StudentKey);
            classInfo = new Training_ClassInfo(int.Parse(studentclassInfo.Properties.Training_ClassKey.ToString()));
            trnprogramInfo = new Training_TrainingProgramInfo(m_iCatalogue_LevelKey, m_iCatalogue_TrainingTypeKey, m_iCatalogue_CourseKey, m_iCatalogue_MajorKey);
            m_iTraining_ProgramKey = trnprogramInfo.Properties.Training_TrainingProgramKey;
            m_iTraining_ProgramKeyChange = m_iTraining_ProgramKey;
            m_iCatalogue_DepartmentKey = m_data.m_DCReadOnly.Catalogue_Majors.GetDepartmentKeyWithMajorKey(int.Parse(m_iCatalogue_MajorKey.ToString()));
            m_iCatalogue_DepartmentKeyChange = m_iCatalogue_DepartmentKey;
            m_iCatalogue_CourseKeyChange = m_iCatalogue_CourseKey;
            m_iCatalogue_LevelKeyChange = m_iCatalogue_LevelKey;
            m_iCatalogue_MajorKeyChange = m_iCatalogue_MajorKey;
            m_iCatalogue_TrainingTypeKeyChange = m_iCatalogue_TrainingTypeKey;
            m_iTraining_ClassKey = classInfo.Properties.Training_ClassKey;
            m_iTraining_ClassKeyChange = m_iTraining_ClassKey;

            txtID.Text = studentclassInfo.Properties.ID;
            txtIDnew.Text = studentclassInfo.Properties.ID;
            txtName.Text = studentInfo.Properties.LastName + " " + studentInfo.Properties.SureName;

            txtClass.Text = classInfo.Properties.Name.ToString();
            txtTraining_Program.Text = trnprogramInfo.Properties.Name;
            gluTraining_TrainingProgram.EditValue = m_iTraining_ProgramKey;
            
            lueCatalogue_Department1.EditValue = m_iCatalogue_DepartmentKey;
            lueCatalogue_Major1.EditValue = m_iCatalogue_MajorKey;
            lueCatalogue_Level1.EditValue = m_iCatalogue_LevelKey;
            lueCatalogue_Course1.EditValue = m_iCatalogue_CourseKey;
            lueCatalogue_TrainingType1.EditValue = m_iCatalogue_TrainingTypeKey;

            gluCatalogue_Department.EditValue = m_iCatalogue_DepartmentKey;
            gluCatalogue_Level.EditValue = m_iCatalogue_LevelKey;
            gluCatalogue_TrainingType.EditValue = m_iCatalogue_TrainingTypeKey;
            gluCatalogue_Course.EditValue = m_iCatalogue_CourseKey;
            gluCatalogue_Major.EditValue = m_iCatalogue_MajorKey;
            gluTraining_Class.EditValue = m_iTraining_ClassKey;
        }

        /// <summary>
        /// Đánh dấu các giá trị đã thay đổi
        /// </summary>

        private void MarkValuesChange()
        {
            if (m_iTraining_ProgramKey != m_iTraining_ProgramKeyChange)
                lbcTrainingProgram.Visible = true;
            else
                lbcTrainingProgram.Visible = false;
            if (m_iCatalogue_DepartmentKey != m_iCatalogue_DepartmentKeyChange)
                lbcDepartment.Visible = true;
            else
                lbcDepartment.Visible = false;
            if (m_iCatalogue_MajorKey != m_iCatalogue_MajorKeyChange)
                lbcMajor.Visible = true;
            else
                lbcMajor.Visible = false;
            if (m_iCatalogue_LevelKey != m_iCatalogue_LevelKeyChange)
                lbcLevel.Visible = true;
            else
                lbcLevel.Visible = false;
            if (m_iCatalogue_CourseKey != m_iCatalogue_CourseKeyChange)
                lbcCourse.Visible = true;
            else
                lbcCourse.Visible = false;
            if (m_iCatalogue_TrainingTypeKey != m_iCatalogue_TrainingTypeKeyChange)
                lbcTrainingType.Visible = true;
            else
                lbcTrainingType.Visible = false;
            if ((m_iTraining_ClassKey != m_iTraining_ClassKeyChange) && (gluTraining_Class.GetIntValue() > 0))
                lbcClass.Visible = true;
            else
                lbcClass.Visible = false;
            if ((txtIDnew.Text != "") && (txtIDnew.Text != txtID.Text))
                lbcID.Visible = true;
            else
                lbcID.Visible = false;
        }

        /// <summary>
        /// Danh sách các phiếu đã yêu cầu
        /// </summary>

        private void LoadListSheet()
        {
            m_tblTable = new DataTable();
            m_tblTable = this.m_data.m_DCReadOnly.Log_Tranfers.GetDataWithUserKey(Utils.LoginInfo.GblLoginInfo.sysLoginUserKey.ToString()).ToDataTable();
            if (m_tblTable.Rows.Count != 0)
            {
                gctView.DataSource = m_tblTable;
            }
            else
                gctView.DataSource = null;
        }

        /// <summary>
        /// Cập nhật Khóa, Bậc, Ngành, Loại hình đào tạo, Khoa
        /// </summary>
        /// <param name="m_iProgramKeyChange"></param>

        private void UpdateLevelMajorCourseTrainingTypeDepartmentChangeWithTrainingProgramKeyChange(int m_iProgramKeyChange)
        {
            Training_TrainingProgramInfo pinfo = new Training_TrainingProgramInfo(m_iProgramKeyChange);

            m_iCatalogue_CourseKeyChange = int.Parse(pinfo.Properties.Catalogue_CourseKey.ToString());
            m_iCatalogue_LevelKeyChange = int.Parse(pinfo.Properties.Catalogue_LevelKey.ToString());
            m_iCatalogue_MajorKeyChange = int.Parse(pinfo.Properties.Catalogue_MajorKey.ToString());
            m_iCatalogue_TrainingTypeKeyChange = int.Parse(pinfo.Properties.Catalogue_TrainingTypeKey.ToString());
            m_iCatalogue_DepartmentKeyChange = m_data.m_DCReadOnly.Catalogue_Departments.ReturnDepartmentKeyWithMajorKey(m_data.m_DCReadOnly.Catalogue_Majors, m_iCatalogue_MajorKeyChange);
        }

        /// <summary>
        /// Hiển thị thông tin các giá trị thay đổi
        /// </summary>

        private void ShowInformationLevelMajorCourseTrainingTypeDepartmentChange()
        {
            gluCatalogue_Level.EditValue = m_iCatalogue_LevelKeyChange;
            gluCatalogue_Major.EditValue = m_iCatalogue_MajorKeyChange;
            gluCatalogue_Course.EditValue = m_iCatalogue_CourseKeyChange;
            gluCatalogue_TrainingType.EditValue = m_iCatalogue_TrainingTypeKeyChange;
            gluCatalogue_Department.EditValue = m_iCatalogue_DepartmentKeyChange;
        }

        /// <summary>
        /// Kiểm tra sinh viên đủ điều kiện chuyển khóa
        /// </summary>
        /// <returns></returns>

        private bool CheckInfoTranferCourse()
        {
            if (gluTraining_Class.EditValue != null)
            {
                m_iTraining_ClassKeyChange = gluTraining_Class.GetIntValue();
                if ((m_iCatalogue_CourseKeyChange != m_iCatalogue_CourseKey) && (m_iTraining_ClassKeyChange != m_iTraining_ClassKey) && (m_iCatalogue_CourseKeyChange > m_iCatalogue_CourseKey) && (gluTraining_Class.Text != ""))
                    return true;
            }
            return false;
        }

        /// <summary>
        /// Kiểm tra sinh viên đủ điều kiện chuyển ngành
        /// </summary>
        /// <returns></returns>

        private bool CheckInfoTranferMajor()
        {
            if (gluTraining_Class.EditValue != null)
            {
                m_iTraining_ClassKeyChange = gluTraining_Class.GetIntValue();
                if ((m_iTraining_ClassKeyChange != m_iTraining_ClassKey) && (gluTraining_Class.Text != "") && (m_iCatalogue_MajorKeyChange != m_iCatalogue_MajorKey))
                    return true;
                return true;
            }
            return false;
        }

        /// <summary>
        /// Kiểm tra sinh viên có trong khóa hoặc ngành cần chuyển đến hay không
        /// </summary>
        /// <param name="m_strStudentKey"></param>
        /// <param name="m_iLevel"></param>
        /// <param name="m_iMajor"></param>
        /// <param name="m_iTrainingType"></param>
        /// <param name="m_iCourse"></param>
        /// <returns></returns>
        public bool CheckStudentToMajorOrCourseNew(string m_strStudentKey, int m_iLevel, int m_iMajor, int m_iTrainingType, int m_iCourse)
        {
            try
            {
                Training_Student_ClassInfo cinfo = new Training_Student_ClassInfo("nguyen.tuanan",m_strTraining_StudentKey, m_iLevel, m_iMajor, m_iTrainingType, m_iCourse);
                if (cinfo.Properties.Catalogue_LevelKey > 0)
                    return false;
                else
                    return true;
            }
            catch { return false; }
        }

        /// <summary>
        /// Lấy danh sách lớp với các điều kiện
        /// </summary>

        private void LoadClass()
        {
            gluTraining_Class.GetData(m_data.m_DCReadOnly.Training_Classes.GetListClassWithDepartmentLevelMajorTrainingTypeCourse(m_iCatalogue_DepartmentKeyChange, m_iCatalogue_LevelKeyChange, m_iCatalogue_MajorKeyChange, m_iCatalogue_TrainingTypeKeyChange, m_iCatalogue_CourseKeyChange), "Training_ClassKey", "Name");
        }

        /// <summary>
        /// Xác nhận chuyển khóa hoặc chuyển ngành
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void btnOK_Click(object sender, EventArgs e)
        {   
            //XraMessageBox.Show("Sinh viên " + grvStudent.GetFocusedRowCellValue("LastName").ToString() + " " + grvStudent.GetFocusedRowCellValue("SureName").ToString() + " đã chuyển sang Chương trình đào tạo mới");

            if (m_data.m_DCReadOnly.Log_Tranfers.CheckStudentTranfer(m_strTraining_StudentKey) == 0)
            {
                if (CheckStudentToMajorOrCourseNew(m_strTraining_StudentKey, m_iCatalogue_LevelKeyChange, m_iCatalogue_MajorKeyChange, m_iCatalogue_TrainingTypeKeyChange, m_iCatalogue_CourseKeyChange))
                {
                    if (gluTraining_Class.Text != "")
                    {
                        if (rtbReasons.Text != "")
                        {
                            DialogResult result = XtraMessageBox.Show("Bạn có muốn gửi yêu cầu " + lueTraining_TranferType.Text + " cho sinh viên " + studentInfo.Properties.LastName + " " + studentInfo.Properties.SureName, "Thông báo", MessageBoxButtons.YesNo);
                            if (result == DialogResult.Yes)
                            {
                                Log_TranferInfo logtranfer = new Log_TranferInfo();
                                logtranfer.Properties.Training_StudentKey = Guid.Parse(m_strTraining_StudentKey);
                                logtranfer.Properties.BeforeID = txtID.Text;
                                if (txtIDnew.Text != "")
                                    logtranfer.Properties.AfterID = txtIDnew.Text;
                                else
                                    logtranfer.Properties.AfterID = txtID.Text;
                                logtranfer.Properties.ClassBefore = m_iTraining_ClassKey;
                                logtranfer.Properties.ClassAfter = m_iTraining_ClassKeyChange;
                                logtranfer.Properties.Training_TrainingProgramKeyBefore = m_iTraining_ProgramKey;
                                logtranfer.Properties.Training_TrainingProgramKeyAfter = m_iTraining_ProgramKeyChange;
                                logtranfer.Properties.Training_TranferTypeKey = int.Parse(lueTraining_TranferType.EditValue.ToString());
                                logtranfer.Properties.RequireUser = Utils.LoginInfo.GblLoginInfo.sysLoginUserKey;
                                logtranfer.Properties.TranferTime = SysDateTime.Now;
                                logtranfer.Properties.Reasons = rtbReasons.Text;
                                logtranfer.Properties.Permit = false;
                                logtranfer.Properties.Refuse = false;
                                logtranfer.Properties.Status = false;
                                logtranfer.Save();
                                XtraMessageBox.Show("Đã gửi yêu cầu " + lueTraining_TranferType.Text + " cho sinh viên " + studentInfo.Properties.LastName + " " + studentInfo.Properties.SureName, "Thông báo");
                            }
                        }
                        else
                        {
                            XtraMessageBox.Show("Vui lòng nhập lý do chyển khóa", "Thông báo");
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Thông tin lớp học chuyển đến không phù hợp", "Thông báo");
                    }
                }
                else
                {
                    XtraMessageBox.Show("Không thể " + lueTraining_TranferType.Text + " !!! Vì sinh viên " + studentInfo.Properties.LastName + " " + studentInfo.Properties.SureName + " đã được chuyển đến " + gluTraining_TrainingProgram.Text);
                }
            }
            else
            { 
                if (m_data.m_DCReadOnly.Log_Tranfers.CheckStudentTranfer(m_strTraining_StudentKey) == 1)
                    XtraMessageBox.Show("Sinh viên " + studentInfo.Properties.LastName + " " + studentInfo.Properties.SureName + " đang chờ duyệt yêu cầu chuyển khóa.", "Thông báo");
                if (m_data.m_DCReadOnly.Log_Tranfers.CheckStudentTranfer(m_strTraining_StudentKey) == 2)
                    XtraMessageBox.Show("Sinh viên " + studentInfo.Properties.LastName + " " + studentInfo.Properties.SureName + " đang chờ duyệt yêu cầu chuyển khóa.", "Thông báo");
                if (m_data.m_DCReadOnly.Log_Tranfers.CheckStudentTranfer(m_strTraining_StudentKey) == 3)
                    XtraMessageBox.Show("Sinh viên " + studentInfo.Properties.LastName + " " + studentInfo.Properties.SureName + " đang chờ duyệt yêu cầu chuyển khóa và chuyển ngành.", "Thông báo");
            }
            LoadListSheet();
        }

        private void gluTraining_TrainingProgram_EditValueChanged(object sender, EventArgs e)
        {
            m_iTraining_ProgramKeyChange = int.Parse(gluTraining_TrainingProgram.EditValue.ToString());
            UpdateLevelMajorCourseTrainingTypeDepartmentChangeWithTrainingProgramKeyChange(m_iTraining_ProgramKeyChange);
            ShowInformationLevelMajorCourseTrainingTypeDepartmentChange();
            LoadClass();
        }

        /// <summary>
        /// Thoát
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void btnClose_Click(object sender, EventArgs e)
        {
            DialogResult result = XtraMessageBox.Show("Bạn có muốn thoát", "Thông báo", MessageBoxButtons.YesNo);
            if (result == DialogResult.Yes)
            {
                this.Close();
            }
        }

        /// <summary>
        /// Xác định hình thức chuyển khóa chuyển ngành
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void Auto_Tick(object sender, EventArgs e)
        {
            if ((m_iCatalogue_MajorKey != m_iCatalogue_MajorKeyChange) && (m_iCatalogue_CourseKey != m_iCatalogue_CourseKeyChange))
            {
                lueTraining_TranferType.EditValue = 3;
            }
            else
            {
                if (m_iCatalogue_CourseKey != m_iCatalogue_CourseKeyChange)
                    lueTraining_TranferType.EditValue = 1;
                else
                    if (m_iCatalogue_MajorKey != m_iCatalogue_MajorKeyChange)
                        lueTraining_TranferType.EditValue = 2;
                    else
                    {
                        lueTraining_TranferType.EditValue = null;
                        lueTraining_TranferType.Text = "Không chuyển";
                    }
            }
            MarkValuesChange();
            if (m_iTraining_ProgramKey != m_iTraining_ProgramKeyChange)
                btnOK.Enabled = true;
            else
                btnOK.Enabled = false;
        }

        /// <summary>
        /// Lây mã lớp thay đổi
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void gluTraining_Class_EditValueChanged(object sender, EventArgs e)
        {
            m_iTraining_ClassKeyChange = int.Parse(gluTraining_Class.EditValue.ToString());
        }

        /// <summary>
        /// Xem chi tiết phiếu yêu cầu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void gctView_DoubleClick(object sender, EventArgs e)
        {
            if (!grvView.IsFilterRow(grvView.FocusedRowHandle))
            {
                int qwe = int.Parse(grvView.GetFocusedRowCellValue("Log_TranferKey").ToString());
                FrmStudent_SubAcademicHandlingTransferCourseDetail coursedetail = new FrmStudent_SubAcademicHandlingTransferCourseDetail(qwe);
                coursedetail.ShowDialog();
            }
        }
    }
}
